package com.huluobo.a2109mouthdemo.adapter;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.a2109mouthdemo.R;
import com.huluobo.a2109mouthdemo.contact.ContactListItemBean;

import java.util.List;

/**
 * Created by LC on 2023/12/5.
 */
public class ContactAdapter extends BaseQuickAdapter<ContactListItemBean, BaseViewHolder> {
    public ContactAdapter(@Nullable List<ContactListItemBean> data) {
        super(R.layout.item_contact, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, ContactListItemBean contactListItemBean) {
        if (contactListItemBean.isShowFirstLetter()) {
            baseViewHolder.findView(R.id.item_contact_firstLetter).setVisibility(View.VISIBLE);
            baseViewHolder.setText(R.id.item_contact_firstLetter, contactListItemBean.getFirstLetter()+"");
        } else {
            baseViewHolder.findView(R.id.item_contact_firstLetter).setVisibility(View.GONE);
        }

        baseViewHolder.setText(R.id.item_contact_username, contactListItemBean.getUsername());
    }
}
